<@_sysSite id=siteId><#assign a=object/></@_sysSite>
<div class="formBar">
    <ul>
        <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
    </ul>
</div>
<div class="pageFormContent" layoutH="60">
    <dl class="nowrap">
        <dt><@t.page 'site'/>:</dt>
        <dd>
            ${(a.name)!}
            <span class="info">以下Nginx配置根据您的站点当前配置信息及绑定的域名动态生成</span>
        </dd>
    </dl>
    <dl class="nowrap">
        <dt>Nginx配置:</dt>
        <dd>
            <textarea name="description" class="code" mode="nginx"><@_disk>
<#assign rootPath=rootPath?replace('\\','/')/>
<#assign dynamicPath=a.dynamicPath?keep_after('//')?keep_before('/')?keep_before(':')/>
<#assign dynamicLocation=a.dynamicPath?keep_after('//')?keep_after('/')/>
<#assign dynamicPort=a.dynamicPath?keep_after('//')?keep_before('/')?keep_after(':')/>
<#assign sitePath=a.sitePath?keep_after('//')?keep_before('/')?keep_before(':')/>
<#assign siteLocation=a.sitePath?keep_after('//')?keep_after('/')/>
<#assign sitePort=a.sitePath?keep_after('//')?keep_before('/')?keep_after(':')/>
<@_sysDomainList advanced=true siteId=siteId>
    <#if page.totalCount gt 0>
        <#if (a.dynamicPath!=a.sitePath&&a.dynamicPath?starts_with(a.sitePath))||(a.dynamicPath!=a.sitePath&&a.sitePath?starts_with(a.dynamicPath))||a.useSsi>
#${a.name} 站点配置
server {
    listen       ${dynamicPort?has_content?then(dynamicPort,80)};
    server_name  ${dynamicPath} <#list page.list as d><#if d.name!=dynamicPath>${d.name}<#sep> </#if><#if d.wild>*.${d.name} </#if></#list>;
            <#if a.useSsi>
    ssi on;
    ssi_silent_errors on;
            </#if>
    location ${dynamicLocation?has_content?then('/'+dynamicLocation,'/')} {
        proxy_redirect off;
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto  $scheme;
        proxy_connect_timeout 5;
        proxy_send_timeout 30;
        proxy_read_timeout 10;
        proxy_pass http://cms;
    }
            <#if a.useSsi>
    location /include/ {
        alias ${rootPath}/web/site_${siteId}/include/;
    }
            </#if>
            <#if (a.dynamicPath!=a.sitePath&&a.dynamicPath?starts_with(a.sitePath))||(a.dynamicPath!=a.sitePath&&a.sitePath?starts_with(a.dynamicPath))>
    #${a.name} 静态站点配置
    location ${siteLocation?has_content?then('/'+siteLocation,'/')} {
        alias   ${rootPath}/web/site_${siteId}/;
        index  index.html;
    }
            </#if>
}
        </#if>
    </#if>
</@_sysDomainList>
<#if !((a.dynamicPath!=a.sitePath&&a.dynamicPath?starts_with(a.sitePath))||(a.dynamicPath!=a.sitePath&&a.sitePath?starts_with(a.dynamicPath)))>
#${a.name} 静态站点配置
server {
    listen       ${sitePort?has_content?then(sitePort,80)};
    server_name  ${sitePath};
    <#if a.useSsi>
    ssi on;
    ssi_silent_errors on;
    ssi_types text/shtml;

        <#if siteLocation?has_content>
    location /include/ {
        alias ${rootPath}/web/site_${siteId}/include/;
    }
        </#if>
    </#if>

    location ${siteLocation?has_content?then('/'+siteLocation,'/')} {
        alias   ${rootPath}/web/site_${siteId}/;
        index  index.html;
        add_header Access-Control-Allow-Origin *;
    }
}
</#if></@_disk></textarea>
            <span class="info">本站点配置应该包含在nginx配置文件 http包中,点击这里查看<a href="sysSite/nginxCommon.html" target="dialog" rel="nginx_common">Nginx通用配置</a></span>
        </dd>
    </dl>
</div>